package com.area.cth.mapper;

import com.area.cth.pojo.Collect;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CollectMapper {
    @Insert("insert into collect(goods_id,collect_user)" +
            " values(#{gId},#{uId})")
    void addLike(Integer gId, Integer uId);

    @Select("select * from collect where goods_id=#{gId} and collect_user=#{uId}")
    Collect likeIf(Integer gId, Integer uId);

    @Delete("delete from collect where id=#{lId}")
    void deleteLike(Integer lId);

    List<Collect> getMyCollect(Integer uid);

    @Delete("delete from collect where goods_id=#{gId} and collect_user=#{uId}")
    void deleteLikeByGoodsId(Integer gId, Integer uId);
}
